package com.example.onlineshop.service;

import com.example.onlineshop.common.AppResult;
import com.example.onlineshop.mapper.ProductMapper;
import com.example.onlineshop.model.product.Product;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class ProductService {

    @Autowired
    private ProductMapper productMapper;

    public AppResult<List<Product>> product() {
        List<Product> products = productMapper.product();
        log.info("products: {}", products);
        return AppResult.appResultSuccess(products);
    }
}
